package com.sport.controller;

import com.sport.entity.SysUser;
import com.sport.service.SysUserService;
import com.sport.utils.QueryInfo;
import com.sport.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/system/user")
@Api(tags = "用户管理")
public class SysUserController {
    @Autowired
    private SysUserService sysUserService;

    @ApiOperation(value = "分页查询")
    @PostMapping("/findPage")
    public Result findPage(@RequestBody QueryInfo queryInfo){
       return sysUserService.findPage(queryInfo);

    }

    @ApiOperation(value = "添加用户信息")
    @PostMapping("/insert")
    public Result insert(@RequestBody SysUser sysUser){
        return sysUserService.insert(sysUser);

    }

    @ApiOperation(value = "修改用户信息")
    @PostMapping("/update")
    public Result update(@RequestBody SysUser sysUser){
        return sysUserService.update(sysUser);

    }
    @ApiOperation(value = "删除用户信息")
    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable("id") long id){
        return sysUserService.delete(id);
    }
}
